﻿using LiveCharts;
using LiveCharts.Defaults;
using LiveCharts.Wpf;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WpfCourse.Model;

namespace WpfCourse.ViewModel
{
    public class HomePageViewModel
    {
        public ObservableCollection<CourseSeriesModel> CourseSeriesList { get; set; }

        public HomePageViewModel()
        {
            this.CourseSeriesList = new ObservableCollection<CourseSeriesModel>
            {
                new CourseSeriesModel
                { 
                    CourseName = "JAVA并发编程实战",
                    SeriesCollection = new SeriesCollection()
                    {
                        new PieSeries(){Title = "JAVA", Values=new ChartValues<ObservableValue>{new ObservableValue(66)}, DataLabels=false},
                        new PieSeries(){Title = "concurrent", Values=new ChartValues<ObservableValue>{new ObservableValue(36)}, DataLabels=false},
                        new PieSeries(){Title = "并发编程", Values=new ChartValues<ObservableValue>{new ObservableValue(66)}, DataLabels=false},
                    },
                    SeriesList = new ObservableCollection<SeriesModel>
                    {
                        new SeriesModel{SeriesName="云课堂", IsGrowing=false,ChangeRate=75,CurrentValue=161},
                        new SeriesModel{SeriesName="云课堂", IsGrowing=true,ChangeRate=-75,CurrentValue=161},
                        new SeriesModel{SeriesName="云课堂", IsGrowing=false,ChangeRate=75,CurrentValue=161},
                        new SeriesModel{SeriesName="云课堂", IsGrowing=true,ChangeRate=-75,CurrentValue=161},
                        new SeriesModel{SeriesName="云课堂", IsGrowing=false,ChangeRate=75,CurrentValue=161},
                    }
                },
                new CourseSeriesModel
                { 
                    CourseName = "JAVA并发编程实战",
                    SeriesCollection = new SeriesCollection()
                    {
                        new PieSeries(){Title = "JAVA", Values=new ChartValues<ObservableValue>{new ObservableValue(66)}, DataLabels=false},
                        new PieSeries(){Title = "concurrent", Values=new ChartValues<ObservableValue>{new ObservableValue(36)}, DataLabels=false},
                        new PieSeries(){Title = "并发编程", Values=new ChartValues<ObservableValue>{new ObservableValue(66)}, DataLabels=false},
                    },
                    SeriesList = new ObservableCollection<SeriesModel>
                    {
                        new SeriesModel{SeriesName="云课堂", IsGrowing=false,ChangeRate=75,CurrentValue=161},
                        new SeriesModel{SeriesName="云课堂", IsGrowing=true,ChangeRate=-75,CurrentValue=161},
                        new SeriesModel{SeriesName="云课堂", IsGrowing=false,ChangeRate=75,CurrentValue=161},
                        new SeriesModel{SeriesName="云课堂", IsGrowing=true,ChangeRate=-75,CurrentValue=161},
                        new SeriesModel{SeriesName="云课堂", IsGrowing=false,ChangeRate=75,CurrentValue=161},
                    }
                },
                new CourseSeriesModel
                { 
                    CourseName = "JAVA并发编程实战",
                    SeriesCollection = new SeriesCollection()
                    {
                        new PieSeries(){Title = "JAVA", Values=new ChartValues<ObservableValue>{new ObservableValue(66)}, DataLabels=false},
                        new PieSeries(){Title = "concurrent", Values=new ChartValues<ObservableValue>{new ObservableValue(36)}, DataLabels=false},
                        new PieSeries(){Title = "并发编程", Values=new ChartValues<ObservableValue>{new ObservableValue(66)}, DataLabels=false},
                    },
                    SeriesList = new ObservableCollection<SeriesModel>
                    {
                        new SeriesModel{SeriesName="云课堂", IsGrowing=false,ChangeRate=75,CurrentValue=161},
                        new SeriesModel{SeriesName="云课堂", IsGrowing=true,ChangeRate=-75,CurrentValue=161},
                        new SeriesModel{SeriesName="云课堂", IsGrowing=false,ChangeRate=75,CurrentValue=161},
                        new SeriesModel{SeriesName="云课堂", IsGrowing=true,ChangeRate=-75,CurrentValue=161},
                        new SeriesModel{SeriesName="云课堂", IsGrowing=false,ChangeRate=75,CurrentValue=161},
                    }
                }
            };
        }
    }
}
